package com.bsoft.DB;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class OracleDBConnection {

    private static Statement stmt =null;

    static{
        try {
            // 1. 加载驱动程序
            Class.forName("oracle.jdbc.OracleDriver");

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    //获取数据库连接
    public static Statement getConnection(){
        try {
            // 2. 获取数据库连接
            Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@139.155.238.178:1521/orcl", "bsadmin", "bsadmintct07");
            // 3. 操作数据库，实现增删改查
            stmt = connection.createStatement();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return stmt;
    }

}
